function IndexCtr($scope,$http){//index 控制器
	$scope.error=0;
	$scope.sendAll=function(){//check username and password
		$scope.name = $scope.name.replace(/：/g, ':');
		if(!$scope.name || !$scope.password){//验证是否为空
			$scope.error=1;
			$scope.errorText="账号或密码不能为空";
			return ;
		}
		$scope.url=constUrlDict["login"];
		var cookieGet=ajaxSendFn({"name":$scope.name,"password":hex_md5($scope.password)},$scope.url,"POST",2);
		if(cookieGet.code==4140 || cookieGet.code==4133){//
			$.cookie("token",null,{ path: '/'});
			cookieGet=ajaxSendFn({"name":$scope.name,"password":$scope.password},$scope.url,"POST",2);
		}
		if(cookieGet.code==200){
			$.cookie("token",cookieGet.result.token,{ path: '/'});
		}else{
			$scope.error=1;
			$scope.errorText=errorCodeJson[cookieGet.code];
			return;
		}

		if(cookieGet.result.type==="M"){
			location.href=indexUrl+"/admin.html";
		}else if(cookieGet.result.type==="K"){
			location.href=indexUrl+"/keeper.html";
		}else if(cookieGet.result.type==="S"){
			location.href=indexUrl+"/staff.html";
		}else{
			alert("服务器繁忙,请稍后再试")
		}

	}
}
